<template>
  <div class="app-container customer-div">
    <el-menu
      :default-active="listQuery.tab"
      class="el-menu-demo"
      mode="horizontal"
      @select="handleSelect">
      <el-menu-item v-if="myCreateInquiryPrice" index="myCreate">我创建的</el-menu-item>
      <el-menu-item v-if="myChargeInquiryPrice" index="myCharge">我负责的</el-menu-item>
      <el-menu-item v-if="allInquiryPrice" index="all">全部询价</el-menu-item>
      <el-menu-item v-if="todayInquiryPrice" index="today">今日询价</el-menu-item>
    </el-menu>
    <!-- 我创建的 -->
    <div
      style="margin-top: 20px"
      v-if="listQuery.tab == 'myCreate' || listQuery.tab == 'all'"
    >
      <el-button
        v-if="listQuery.tab == 'myCreate'"
        size="small"
        @click="addInquiry('add',null)"
        type="primary"
      >
        发布询价
      </el-button>

      <el-button size="small" @click="generateOrder('more',null)" type="primary" :loading="orderLoading">
        生成订单
      </el-button>

      <el-button size="small" @click="generateOrder('more',null,'承兑')" type="primary" :loading="orderLoading1">
        承兑下单
      </el-button>

      <el-button
        v-if="listQuery.tab == 'myCreate'"
        size="small"
        @click="showPop11('moreXun')"
        type="primary"
      >
        批量询运费
      </el-button>
      <el-button
        v-if="listQuery.tab == 'myCreate'"
        size="small"
        @click="showCpx"
        type="primary"
      >
        产品线设置
      </el-button>
      <div style="float:right;margin-top: -10px;" v-if="listQuery.tab == 'myCreate'">
        <el-popover
          :visible-arrow="false"
          popper-class="popper-zdy"
          placement="bottom-end"
          trigger="hover">
          <img src="https://pic.moresu.com/FtjF4fiei4o8NKcavauPtic3X7qZ" slot="reference"/>
          <img src="https://pic.moresu.com/Foec_SstpH1G9v4gClxnb0vb-6Z0" style="box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);border-radius: 14px;display: block;"/>
        </el-popover>

      </div>
    </div>
    <!--数据列表-->
    <div class="table-container">
      <!-- 我创建的 -->
      <vxe-grid
        ref="xGrid"
        v-if="this.listQuery.tab != 'myCharge'"
        v-bind="gridOptions"
        size="mini"
        :loading="listLoading"
        @checkbox-change="checkboxChange"
        @checkbox-all="selectAllCheckboxChange"
        :key="listLoading"
      >
        <template #form>
          <!--搜索-->
          <div>
            <div
              style="
                background: #f5f7fa;
                padding: 15px 15px 0 15px;
                border: 1px solid #ebeef5;
                border-bottom: 0.5px solid #ebeef5;
              "
            >
              <el-form
                :inline="true"
                :model="listQuery"
                size="mini"
                label-width="100px"
              >
                <el-form-item
                  label="客户编号："
                  v-if="listQuery.tab == 'myCreate' || listQuery.tab == 'all'"
                >
                  <el-input v-model="listQuery.customerNumber"></el-input>
                </el-form-item>

                <el-form-item label="客户名称：">
                  <el-input v-model="listQuery.customerName" clearable></el-input>
                </el-form-item>

                <el-form-item
                  label="询价时间："
                  v-if="listQuery.tab != 'today'"
                >
                  <el-date-picker
                    v-model="listQuery.inquiryDate"
                    value-format="yyyy-MM-dd"
                    type="daterange"
                    format="yyyy 年 MM 月 dd 日"
                    range-separator="至"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期"
                  >
                  </el-date-picker>
                </el-form-item>
                <el-form-item
                  label="牌号："
                  v-if="listQuery.tab == 'today' || listQuery.tab == 'all'"
                >
                  <el-input clearable v-model="listQuery.goodsSn"></el-input>
                </el-form-item>
                <el-form-item label="厂家：" v-if="listQuery.tab == 'today'">
                  <el-select
                    clearable
                    v-model="listQuery.brandName"
                    filterable
                    remote
                    reserve-keyword
                    :remote-method="getBrandList"
                    :loading="loading"
                  >
                    <el-option
                      v-for="(item,index) in brandList"
                      :key="index"
                      :label="item.brandName"
                      :value="item.brandName"
                    >
                    </el-option>
                  </el-select>
                </el-form-item>
                 <el-form-item label="部门：" v-if="listQuery.tab == 'all'||listQuery.tab == 'today'">
                  <el-select
                    clearable
                    v-model="listQuery.departmentId"
                    filterable
                    multiple
                  >
                    <el-option
                      v-for="item in departmenList"
                      :key="item.divsionDeptId"
                      :label="item.divsionDeptName"
                      :value="item.divsionDeptId"
                    >
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="采购员：" v-if="listQuery.tab == 'all'">
                  <el-select style="width:100px" v-model="listQuery.purchaseUserId" filterable clearable>
                    <el-option
                      v-for="item in userOptionList2"
                      :key="item.userId"
                      :label="item.userName"
                      :value="item.userId">
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="业务员：" v-if="listQuery.tab == 'all'">
                  <el-select style="width:100px" v-model="listQuery.userId" filterable clearable>
                    <el-option
                      v-for="item in userOptionList"
                      :key="item.userId"
                      :label="item.userName"
                      :value="item.userId">
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item>
                  <el-button @click="handleSearchList()" type="primary">
                    查询
                  </el-button>
                  <el-button @click="batchNotSale()" type="primary" v-if="type == 80 && listQuery.tab == 'myCreate'">
                    批量未成交原因填写
                  </el-button>
                </el-form-item>
              </el-form>
            </div>
          </div>
        </template>
        <template #pager>
          <div style="overflow: hidden">
            <div class="pagination-container" style="float: right">
              <el-pagination
                background
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
                layout="total, sizes,prev, pager, next,jumper"
                :current-page.sync="listQuery.pageNum"
                :page-size="listQuery.pageSize"
                :page-sizes="[10, 15, 20, 50, 100, 200]"
                :total="count"
              >
              </el-pagination>
            </div>
          </div>
        </template>
        <template #toolbar_buttons>
          <el-radio-group
            v-model="type"
            size="small"
            @change="changeType"
            v-if="listQuery.tab != 'today'"
          >
            <el-radio-button label="">全部({{allInquiryCount}})</el-radio-button>
            <el-radio-button label="0">待采购报价({{waitPriceInquiryCount}})</el-radio-button>
            <!-- <el-radio-button label="30">待采购确认价格</el-radio-button> -->
            <!-- <el-radio-button label="40" v-if="listQuery.tab != 'myCharge'"
              >待物流报价</el-radio-button
            > -->
            <!-- <el-radio-button label="50" v-if="listQuery.tab != 'myCharge'"
              >待成交</el-radio-button
            > -->
            <el-radio-button label="60" v-if="listQuery.tab != 'myCharge'"
              >未成交({{unDealInquiryCount}})</el-radio-button
            >
            <el-radio-button label="70" v-if="listQuery.tab != 'myCharge'"
              >已下单({{orderInquiryCount}})</el-radio-button
            >
            <el-radio-button label="10" v-if="listQuery.tab != 'myCharge'"
              >已取消({{cancelInquiryCount}})</el-radio-button
            >
            <el-radio-button label="80" v-if="listQuery.tab != 'myCharge'">销售超期未下单({{outTimeInquiryCount}})</el-radio-button>
          </el-radio-group>
        </template>
        <template #num1_default="{ row, rowIndex }">
          <el-link
            @click="toDetail(row)"
            type="primary"
            style="font-size: 12px"
            >{{ row.orderSn }}</el-link
          >
        </template>
        <template #num2_default="{ row, rowIndex }">
          <span>{{ row.expectSendDate }}</span>
          <span
            style="
              background: red;
              color: #fff;
              padding: 0 5px;
              border-radius: 5px;
            "
            v-if="row.urgentType == '必须'"
            >必须</span
          >
          <span
            style="
              background: #ff6600;
              color: #fff;
              padding: 0 5px;
              border-radius: 5px;
            "
            v-if="row.urgentType == '可延1-2天'"
            >1-2天</span
          >
          <span
            style="
              background: #ff9900;
              color: #fff;
              padding: 0 5px;
              border-radius: 5px;
            "
            v-if="row.urgentType == '可延1-2周'"
            >1-2周</span
          >
          <span
            style="
              background: #0099ff;
              color: #fff;
              padding: 0 5px;
              border-radius: 5px;
            "
            v-if="row.urgentType == '等客户通知'"
            >等待</span
          >
        </template>
        <template #num3_default="{ row, rowIndex }">
          <el-button
            style="margin-right: 10px"
            type="text"
            size="small"
            v-if="
              (row.isMyInquiry == 1 || listQuery.tab == 'all'||listQuery.tab=='myCreate') &&
              (row.priceState == 20 ||row.priceState == 30 ||row.priceState == 50) &&
              row.priceSendTypes == '自提' &&row.sendTypes == '送到' &&row.freightState == 0
            "
            @click="showPop11('oneXun', row)"
            >询运费</el-button
          >
          <el-button
            style="margin-right: 10px"
            type="text"
            size="small"
            v-if="
              row.payTypes != '现汇' && (row.isMyInquiry == 1 || listQuery.tab == 'all'||listQuery.tab=='myCreate') &&
              (row.priceState == 20 ||row.priceState == 30 ||row.priceState == 50)
            "
            :disabled="row.isEnableOrder != 1"
            @click="generateOrder('one',row)"
            >生成订单</el-button
          >
          <el-dropdown trigger="click" size="mini" style="margin-right: 10px"
                       v-else-if="row.payTypes == '现汇' && (row.isMyInquiry == 1 || listQuery.tab == 'all'||listQuery.tab=='myCreate') &&
              (row.priceState == 20 ||row.priceState == 30 ||row.priceState == 50)">
              <span class="el-dropdown-link" style="cursor: pointer; color: #409eff; font-size: 12px">生成订单 <i class="el-icon-arrow-down el-icon--right"></i></span>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item>
                  <el-button type="text" size="small" :disabled="row.isEnableOrder != 1" @click="generateOrder('one',row)">正常下单</el-button>
                </el-dropdown-item>
                <el-dropdown-item>
                  <el-button type="text" size="small" :disabled="row.isEnableOrder != 1" @click="generateOrder('one',row,'承兑')">承兑下单</el-button>
                </el-dropdown-item>
              </el-dropdown-menu>
          </el-dropdown>

          <el-dropdown trigger="click" size="mini">
            <span
              class="el-dropdown-link"
              style="cursor: pointer; color: #409eff; font-size: 12px"
              >更多 <i class="el-icon-arrow-down el-icon--right"></i
            ></span>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item>
                <el-button
                  v-if="listQuery.tab != 'today'"
                  style="margin-right: 10px"
                  type="text"
                  size="small"
                  @click="showPop6(row)"
                  >日志</el-button
                >
              </el-dropdown-item>
              <el-dropdown-item>
                <el-button
                  style="margin-right: 10px"
                  type="text"
                  size="small"
                  v-if="
                    row.inquiryState == 0 &&
                    (row.isMyInquiry == 1 || listQuery.tab == 'all'||listQuery.tab=='myCreate')
                  "
                  @click="cancelPrice(row)"
                  >取消询价</el-button
                >
              </el-dropdown-item>
              <el-dropdown-item>
                <el-button
                  style="margin-right: 10px"
                  type="text"
                  size="small"
                  v-if="
                    row.priceState == 20 ||row.priceState == 30 ||row.priceState == 40 ||
                    (row.priceState == 50 &&(row.isMyInquiry == 1 || listQuery.tab == 'all'||listQuery.tab=='myCreate'))
                  "
                  @click="showPop3(row)"
                  >还价</el-button
                >
              </el-dropdown-item>
              <el-dropdown-item>
                <el-button
                  style="margin-right: 10px"
                  type="text"
                  size="small"
                  v-if="
                    row.inquiryState != 10 &&
                    row.inquiryState != 60 &&
                    row.inquiryState != 70 &&
                    (row.isMyInquiry == 1||listQuery.tab=='myCreate')
                  "
                  @click="editCompany(row)"
                  >修改询价客户</el-button
                >
              </el-dropdown-item>
              <el-dropdown-item>
                <el-button
                  style="margin-right: 10px"
                  type="text"
                  size="small"
                  v-if="
                    row.inquiryState != 0 &&
                    row.inquiryState != 10 &&
                    row.inquiryState != 70 &&
                    row.inquiryState != 60 &&
                    (row.isMyInquiry == 1 || listQuery.tab == 'all'||listQuery.tab=='myCreate')
                  "
                  @click="showPop5(row)"
                  >未成交</el-button
                >
              </el-dropdown-item>
              <el-dropdown-item>
                <el-button
                  style="margin-right: 10px"
                  type="text"
                  size="small"
                  v-if="
                    row.inquiryState != 0 &&
                    row.inquiryState != 10 &&
                    row.inquiryState != 70
                  "
                  @click="showPop4(row)"
                  >我有低价</el-button
                >
              </el-dropdown-item>
              <el-dropdown-item>
                <el-button
                  style="margin-right: 10px"
                  type="text"
                  size="small"
                  v-if="listQuery.tab == 'myCreate' && row.isEnable == 1"
                  @click="addInquiry('edit',row)"
                  >复制询价</el-button
                >
              </el-dropdown-item>
              <el-dropdown-item>
                <el-button
                  style="margin-right: 10px"
                  type="text"
                  size="small"v-if="listQuery.tab == 'myCreate' &&
                   row.createSource == 'MORESU' &&
                  (row.priceState == 20  || row.priceState == 50)
                  &&row.moresuPrice == ''
                  "

                  @click="showMoresuPrice(row)"
                >销售报价</el-button>
              </el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </template>
        <template #num4_default="{ row, rowIndex }">
          <img src="../../../assets/images/moresu.png" style="vertical-align: middle;" v-if="row.createSource == 'MORESU'"/>
          <span style="vertical-align: middle;">{{ row.goodsName }}/{{ row.goodsSn }}</span>
        </template>
        <template #num6_default="{ row, rowIndex }">
          <span>{{ row.inquiryState | formatInquiryState }}</span>
        </template>
        <template #num7_default="{ row, rowIndex }">
          <span>{{ row.freightState | formatFreightState }}</span>
        </template>
        <template #num9_default="{ row, rowIndex }">
          <span v-if="row.sendDate>row.receiveDate" style="color: red;">{{ row.sendDate }}</span>
          <span v-else>{{ row.sendDate }}</span>
        </template>
        <template #customerName_default="{ row, rowIndex }">
          <div style="white-space: normal;">{{row.customerNumber }}</div>
          <!--是否有权限-->
          <div v-if="row.isShowCustomerName" style="white-space: normal;">{{row.customerName}}</div>
        </template>
      </vxe-grid>
      <!-- 我负责的 -->
      <vxe-grid
        ref="xGrid2"
        v-else
        v-bind="gridOptions2"
        size="mini"
        :loading="listLoading"
        @checkbox-change="checkboxChange2"
        @checkbox-all="selectAllCheckboxChange2"
        :key="listLoading"
      >
        <template #form>
          <!--搜索-->
          <div>
            <div
              style="
                background: #f5f7fa;
                padding: 15px 15px 0 15px;
                border: 1px solid #ebeef5;
                border-bottom: 0.5px solid #ebeef5;
              "
            >
              <el-form
                :inline="true"
                :model="listQuery"
                size="mini"
                label-width="100px"
              >
                <el-form-item label="询价人：">
                  <el-select
                    clearable
                    v-model="listQuery.inquiryUserId"
                    filterable
                    remote
                    reserve-keyword2
                    placeholder="请输入关键词"
                    :loading="loading"
                  >
                    <el-option
                      v-for="item in salesmanLists"
                      :key="item.userId"
                      :label="item.userName"
                      :value="item.userId"
                    >
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="询价时间：">
                  <el-date-picker
                    v-model="listQuery.inquiryDate"
                    value-format="yyyy-MM-dd"
                    type="daterange"
                    format="yyyy 年 MM 月 dd 日"
                    range-separator="至"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期"
                  >
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="牌号：">
                  <el-select
                    clearable
                    v-model="listQuery.goodsKingId"
                    filterable
                    remote
                    reserve-keyword
                    placeholder="请输入关键词"
                    :remote-method="remoteMethod2"
                    :loading="loadingoptions2">
                    <el-option
                      v-for="item in options2"
                      :key="item.kingId"
                      :label="item.goodsSn"
                      :value="item.kingId">
                    </el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="是否允许下单：">
                  <el-select v-model="listQuery.isEnableOrder "  placeholder="请选择" clearable>
                    <el-option key="1" label="正常下单" value="1"></el-option>
                    <el-option key="0" label="禁止下单" value="0"></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item label="过滤超时与同步询价：" label-width="150px">
                  <el-select v-model="listQuery.isNeedMyCharge "  placeholder="请选择" clearable>
                    <el-option key="1" label="是" value="1"></el-option>
                    <el-option key="0" label="否" value="0"></el-option>
                  </el-select>
                </el-form-item>
                <el-form-item>
                  <el-button @click="handleSearchList()" type="primary">
                    查询
                  </el-button>
                </el-form-item>
                  <el-form-item>
                    <el-button
                    @click="adjustPrice"
                    type="primary"
                    >
                    批量调价
                  </el-button>
                    <el-button
                      :loading="btnTypeLoading1"
                      @click="changeMoreType(1)"
                      type="success">
                      批量允许下单
                    </el-button>
                      <el-button
                        :loading="btnTypeLoading2"
                        @click="changeMoreType(0)"
                        type="danger">
                        批量禁止下单
                      </el-button>

                </el-form-item>
              </el-form>
            </div>
          </div>
        </template>
        <template #pager>
          <div style="overflow: hidden">
            <div class="pagination-container" style="float: right">
              <el-pagination
                background
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
                layout="total, sizes,prev, pager, next,jumper"
                :current-page.sync="listQuery.pageNum"
                :page-size="listQuery.pageSize"
                :page-sizes="[10, 15, 20, 50, 100, 200]"
                :total="count"
              >
              </el-pagination>
            </div>
          </div>
        </template>
        <template #toolbar_buttons>
          <el-radio-group v-model="type2" size="small" @change="changeType2">
            <el-radio-button label="">全部({{allInquiryCount}}/{{allInquiryGoodsNum}}吨)</el-radio-button>
            <el-radio-button label="0">待采购报价({{waitPriceInquiryCount}}/{{waitPriceInquiryGoodsNum}}吨)</el-radio-button>
            <el-radio-button label="30">待采购确认价格({{waitCheckInquiryCount}}/{{waitCheckInquiryGoodsNum}}吨)</el-radio-button>
            <el-radio-button label="70">已下单({{orderInquiryCount}}/{{orderInquiryGoodsNum}}吨)</el-radio-button>
            <el-radio-button label="50">已报价({{priceInquiryCount}}/{{priceInquiryGoodsNum}}吨)</el-radio-button>
          </el-radio-group>
        </template>
        <template #num3_default="{ row, rowIndex }">
          <el-button
            style="margin-right: 10px"
            type="text"
            size="small"
            @click="showPop6(row)"
            >日志</el-button
          >
          <el-button
            style="margin-right: 10px"
            type="text"
            size="small"
            v-if="
              row.isMyPrice == 1 && row.priceState == 30 && row.isIntroduce == 0
            "
            @click="showPop8(row)"
            >确认价格</el-button
          >

          <el-button
            style="margin-right: 10px"
            type="text"
            size="small"
            v-if="
              row.isMyPrice == 1 &&
              row.isIntroduce == 0 &&
              (row.priceState == 20 ||
                row.priceState == 30 ||
                row.priceState == 40 ||
                row.priceState == 50)
            "
            @click="showPop2(row)"
            >修改报价</el-button
          >
          <el-button
            style="margin-right: 10px"
            type="text"
            size="small"
            v-if="row.isNeedMyPrice == 1 && row.isIntroduce == 0"
            @click="addPrice(row)"
            >我要报价</el-button
          >
          <el-button
            style="margin-right: 10px"
            type="text"
            size="small"
            v-if="row.inquiryState == 0 && row.isIntroduce == 0"
            @click="noPrice(row)"
            >暂无报价</el-button
          >
          <!-- 邀请报价 -->
          <el-button
            style="margin-right: 10px"
            type="text"
            size="small"
            v-if="
              (row.inquiryState == 0 ||
                row.inquiryState == 20 ||
                row.inquiryState == 50) &&
              row.isIntroduce == 0
            "
            @click="invitQuotation(row)"
            >邀请报价</el-button
          >
          <!-- 推送至第三方 -->
          <el-button
            style="margin-right: 10px"
            v-if="(row.inquiryState == 0||row.inquiryState==60)&&row.gxInquirySn==''"
            type="text"
            size="small"
            @click="pushInquiryToGxMore(row)"
            >推送至第三方</el-button
          >
        </template>
        <template #customerTag_default="{ row, rowIndex }">
            <div v-for="item in row.customerTag" style="margin-bottom:4px;" :key="item.tagName">
               <crm-tag :item="item"></crm-tag>
            </div>
        </template>
        <template #num5_default="{ row, rowIndex }">
          <el-row class="table-row">
            <el-col :span="8" class="table-col">客户编号</el-col>
            <el-col :span="16" class="table-col">
              <img src="../../../assets/images/moresu.png" style="vertical-align: middle;" v-if="row.createSource == 'MORESU'"/>
              <el-popover
                style="display: inline-block"
                @show="getCustomerOrderInfo(row.customerId)"
                placement="bottom"
                width="300"
                trigger="click">
                <div style="font-size: 12px">
                  <el-row class="table-row">
                    <el-col :span="10" class="table-col">全部成交量</el-col>
                    <el-col :span="14" class="table-col">{{customerInfo.allOrderGoodsNum}}</el-col>
                  </el-row>
                  <el-row class="table-row">
                    <el-col :span="10" class="table-col">今年成交量</el-col>
                    <el-col :span="14" class="table-col">{{customerInfo.thisYearOrderGoodsNum}}</el-col>
                  </el-row>
                  <el-row class="table-row">
                    <el-col :span="10" class="table-col">全部成交次数</el-col>
                    <el-col :span="14" class="table-col">{{customerInfo.allOrderCount}}</el-col>
                  </el-row>
                  <el-row class="table-row">
                    <el-col :span="10" class="table-col">今年成交次数</el-col>
                    <el-col :span="14" class="table-col">{{customerInfo.thisYearOrderCount}}</el-col>
                  </el-row>
                  <el-row class="table-row">
                    <el-col :span="10" class="table-col">第一次成交时间</el-col>
                    <el-col :span="14" class="table-col">{{customerInfo.firstOrderTime}}</el-col>
                  </el-row>
                  <el-row class="table-row">
                    <el-col :span="10" class="table-col">最近成交时间</el-col>
                    <el-col :span="14" class="table-col">{{customerInfo.lastOrderTime}}</el-col>
                  </el-row>
                  <el-row class="table-row">
                    <el-col :span="10" class="table-col">客户性质</el-col>
                    <el-col :span="14" class="table-col">{{customerInfo.customerQuality}}</el-col>
                  </el-row>
                  <el-row class="table-row">
                    <el-col :span="10" class="table-col">客户规模</el-col>
                    <el-col :span="14" class="table-col">{{customerInfo.newScale}}</el-col>
                  </el-row>
                  <el-row class="table-row">
                    <el-col :span="10" class="table-col">规模性质</el-col>
                    <el-col :span="14" class="table-col">{{customerInfo.newNature}}</el-col>
                  </el-row>
                </div>
                <div slot="reference" style="cursor: pointer;text-decoration: underline;color:#409eff">{{ row.customerNumber }}</div>
              </el-popover>

              <span></span>
            </el-col>
          </el-row>
          <el-row class="table-row" v-if="row.isShowCustomerName">
            <el-col :span="8" class="table-col">客户名称</el-col>
            <el-col :span="16" class="table-col">
              <span>{{ row.customerName }}</span>
            </el-col>
          </el-row>
          <el-row class="table-row" style="height:36px;">
            <el-col :span="8" class="table-col" style="color:Red;height:100%;display: flex;align-items: center">订单分类（销售）</el-col>
            <el-col :span="16" class="table-col" style="color:Red;height:100%;display: flex;align-items: center;">
              <span style="color:red;">{{ row.saleCustomerType }}</span>
            </el-col>
          </el-row>
          <el-row class="table-row" style="height:36px;">
            <el-col :span="8" class="table-col" style="color:Red;height:100%;display: flex;align-items: center">订单分类（采购）</el-col>
            <el-col :span="16" class="table-col" style="color:Red;height:100%;display: flex;align-items: center;">
              <el-select v-model="row.newPurchaseCustomerType" size="mini" style="height:28px;line-height: 28px;width:110px;margin-left:2px" v-if="row.purchaseCustomerType == ''">
                <el-option
                  v-for="(item,index) in orderCustomerTypeList"
                  :key="index"
                  :label="item.cddValue"
                  :value="item.cddValue">
                </el-option>
              </el-select>
              <el-button type="primary" :disabled="row.newPurchaseCustomerType == ''" style="height:28px;line-height: 26px;font-size: 12px;width:60px;padding:0;margin-left:2px" v-if="row.purchaseCustomerType == ''" @click="setPurchaseCustomerType(row)">确定</el-button>
              <span style="color:red;" v-else-if="row.purchaseCustomerType != ''">{{ row.purchaseCustomerType }}</span>
            </el-col>
          </el-row>
          <el-row class="table-row">
            <el-col :span="8" class="table-col">厂家牌号</el-col>
            <el-col :span="16" class="table-col">{{ row.goodsSn }} <span v-if="row.isMallOrders == 1" style="background:#FF455B;;color:#fff;font-size: 10px;border-radius: 4px;padding:0 5px;">商城订单</span></el-col>
          </el-row>
          <el-row class="table-row">
            <el-col :span="8" class="table-col">数量（吨）</el-col>
            <el-col :span="16" class="table-col"> {{ row.goodsNum }}</el-col>
          </el-row>
          <el-row class="table-row">
            <el-col :span="8" class="table-col">收货地区</el-col>
            <el-col :span="16" class="table-col"> {{ row.receiveArea }}</el-col>
          </el-row>
          <el-row class="table-row">
            <el-col :span="8" class="table-col">期望发货时间</el-col>
            <el-col :span="16" class="table-col"> {{ row.receiveDate }}</el-col>
          </el-row>
          <el-row class="table-row">
            <el-col :span="8" class="table-col">最晚发货时间</el-col>
            <el-col :span="16" class="table-col">{{
              row.latestReceiveDate
            }}</el-col>
          </el-row>
          <el-row class="table-row">
            <el-col :span="8" class="table-col">发货紧急程度</el-col>
            <el-col :span="16" class="table-col">{{
              row.inquiryUrgentType
            }}</el-col>
          </el-row>
          <el-row class="table-row" v-if="row.inquiryUrgentRemark">
            <el-col :span="8" class="table-col">紧急程度备注</el-col>
            <el-col :span="16" class="table-col">{{
              row.inquiryUrgentRemark
            }}</el-col>
          </el-row>
          <el-row class="table-row">
            <el-col :span="8" class="table-col">结算方式</el-col>
            <el-col :span="16" class="table-col"> {{ row.payTypes }}</el-col>
          </el-row>
          <el-row class="table-row">
            <el-col :span="8" class="table-col">收货方式</el-col>
            <el-col :span="16" class="table-col"> {{ row.sendTypes }}</el-col>
          </el-row>
          <el-row class="table-row">
            <el-col :span="8" class="table-col">是否分批发货</el-col>
            <el-col :span="16" class="table-col"> <span :style="{color:row.isBatchPaid == 1 ? 'red' : '#606266'}">{{ row.isBatchPaid == 1 ? '是' : '否' }}</span></el-col>
          </el-row>
          <el-row class="table-row">
            <el-col :span="8" class="table-col">是否预售</el-col>
            <el-col :span="16" class="table-col"> <span :style="{'color':row.isPreorder == 1 ? 'red' : '#606266'}">{{ row.isPreorder == 1 ? '是' : '否' }}</span></el-col>
          </el-row>
        </template>
        <template #num6_default="{ row, rowIndex }">
          <span>{{ row.inquiryState | formatInquiryState }}</span>
        </template>

        <template #shareClickCount_default="{ row, rowIndex }">
          <div style="width:100%;">
            <el-row class="table-row">
              <el-col :span="24" class="table-col" style="border-right: 0;border-bottom: 1px solid #ddd">分享点击<span style="color:#409eff;padding:0 5px">{{ row.shareClickCount }}次</span></el-col>
              <el-col :span="24" class="table-col">
                <span style="cursor: pointer;color: #409eff;text-decoration: underline;padding-left:5px" v-if="row.isShareInquiryUrl == 1" @click="copyShareInquiryUrl(row)">分享询盘链接</span>
              </el-col>
            </el-row>
            <el-row class="table-row">
              <el-col :span="24" class="table-col" style="border-right: 0;border-bottom: 1px solid #ddd">是否商城订单</el-col>
              <el-col :span="24" class="table-col">
                <el-switch
                  @change="changeGoodsSnType(row,'isMallOrders')"
                  v-if="row.inquiryState != 70"
                  v-model="row.isMallOrders"
                  active-text="是"
                  inactive-text="否"
                  :active-value="1"
                  :inactive-value="0">
                </el-switch>
                <span v-else>{{row.isMallOrders == 1 ? '是' : '否'}}</span>
              </el-col>
            </el-row>
            <el-row class="table-row">
              <el-col :span="24" class="table-col" style="border-right: 0;border-bottom: 1px solid #ddd">是否允许下单</el-col>
              <el-col :span="24" class="table-col">
                <el-switch
                  v-if="row.inquiryState != 70"
                  @change="changeGoodsSnType(row,'isEnableOrder')"
                  v-model="row.isEnableOrder"
                  active-text="是"
                  inactive-text="否"
                  :active-value="1"
                  :inactive-value="0">
                </el-switch>
                <span v-else>{{row.isEnableOrder == 1 ? '是' : '否'}}</span>
              </el-col>
            </el-row>
          </div>

        </template>

        <template #chargeUserName="{ row, rowIndex }">
            <div>{{row.chargeUserName}}</div>
            <div style="font-weight: bold" v-if="row.inquiryPushType != ''" :style="{'color':row.inquiryPushType.includes('同步')  ? '#409EFF' : row.inquiryPushType.includes('超时') ? 'red' : '#606266'}">【{{row.inquiryPushType}}】</div>
        </template>

      </vxe-grid>
    </div>
    <!-- 修改询价客户 -->
    <el-dialog
      title="修改询价客户"
      :visible.sync="dialogVisible2"
      :beforeClose="handleClose2"
      width="450px"
    >
      <div>
        <el-form
          size="mini"
          :model="sendForm"
          label-width="100px"
          ref="sendForm"
          :rules="rules"
        >
          <el-form-item label="询价客户：">
            <span>{{ sendForm.customerName }}</span>
          </el-form-item>
          <el-form-item label="关联客户：" prop="customerId">
            <el-select
              style="width: 200px"
              v-model="sendForm.customerId"
              clearable
            >
              <el-option
                v-for="item in relationCusList"
                :key="item.customerId"
                :value="item.customerId"
                :label="item.customerName"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="handleClose2">取 消</el-button>
        <el-button type="primary" @click="handleConfirm2" :loading="btnLoading2"
          >确 定</el-button
        >
      </span>
    </el-dialog>
    <!-- 产品线设置 -->
    <el-dialog
      title="产品线设置"
      :visible.sync="dialogVisible"
      :beforeClose="handleClose"
      width="450px"
    >
      <div style="max-height: 300px; overflow-y: auto; padding-top: 5px">
        <div style="margin-bottom: 10px">选择关注的产品线</div>
        <el-checkbox
          v-for="item in materialClassList"
          :true-label="1"
          :false-label="0"
          v-model="item.isSelected"
          :label="item.categoryName"
          :key="item.categoryId"
          style="width: 100px"
          >{{ item.categoryName }}</el-checkbox
        >
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="handleClose">取 消</el-button>
        <el-button type="primary" @click="handleConfirm" :loading="btnLoading"
          >确 定</el-button
        >
      </span>
    </el-dialog>

    <!--发起询价-->
    <addInquirys @update="handleSearchList" ref="addInquirys"></addInquirys>

    <!--出低价-->
    <addPrice @update="handleSearchList" ref="addPrice"></addPrice>

    <!--无报价-->
    <noPrice @update="handleSearchList" ref="noPrice"></noPrice>

    <!--日志-->
    <loger ref="loger"></loger>

    <!--查看低价-->
    <lowPrice @update="handleSearchList" ref="lowPrice"></lowPrice>

    <!--未成交-->
    <noDeal @update="handleSearchList" ref="noDeal"></noDeal>

    <!--还价-->
    <offer @update="handleSearchList" ref="offer"></offer>

    <!--确认价格-->
    <confirmOffer @update="handleSearchList" ref="confirmOffer"></confirmOffer>

    <!--立即下单-->
    <addOrder @update="handleSearchList" ref="addOrder"></addOrder>

    <!--批量询运费-->
    <batchFreight @update="handleSearchList" ref="batchFreight"></batchFreight>

    <!-- 批量调价 -->
    <addAdjustPrice ref="addAdjustPrice" @update="changeType2"></addAdjustPrice>

    <!-- 我要报价 -->
    <addInquiryPrice @update="handleSearchList" ref="addInquiryPrice"></addInquiryPrice>
    <!-- 邀请报价 -->
    <addQuotationMember ref="addQuotationRef"></addQuotationMember>

    <!--销售报价-->
    <moresuPrice @update="handleSearchList" ref="moresuPrice"></moresuPrice>

    <!-- 下单注意提示 -->
    <el-dialog
      title="下单注意"
      :visible.sync="dialogVisible3"
      width="600px">
      <div>
         {{dialogTitle}}
        <span style="color:red;font-weight: bold">{{copyWords}}</span>
        <el-button size="small" type="text" @click="copyItem" style="text-decoration: underline">复制</el-button>
      </div>
      <div style="margin-top:20px;font-weight: bold">预售风险案例展示</div>
      <div style="margin-top: 5px">{{dialogContent}}</div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible3=false">取 消</el-button>
        <el-button type="primary" @click="handleConfirm3">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import {getOrderUsersList,getConfigList} from '@/api/partner'
import {
  getCustomerList,
  getPriceList,
  getChargeList,
  inquiryOperate,
  getPreOrderContent,
  getMyGoodsOwnerShipAPI,
  relationCustomers,
  myMaterialClassList,
  setAttentionCategoryId,
  getSaleDepartListAPI,
  pushInquiryToGxMoreAPI,
  customerOrderInfo,
  addShareClick,
  editPurchaseCustomerType
} from "@/api/allInLine/inquiry";
import {goodsList} from '@/api/company'
import { getGoodsSnList, materialBrandList,setEnableOrder } from "@/api/allInLine/goods";
import { formatDate } from "@/utils/date";
import addAdjustPrice from './InquiryCom/addAdjustPrice.vue'
import addInquirys from "./InquiryCom/addInquirys";
import addPrice from "./InquiryCom/addPrice";
import noPrice from "./InquiryCom/noPrice";
import loger from "./InquiryCom/loger";
import lowPrice from "./InquiryCom/lowPrice";
import addTempOffer from "./InquiryCom/addTempOffer";
import noDeal from "./InquiryCom/noDeal";
import offer from "./InquiryCom/offer";
import confirmOffer from "./InquiryCom/confirmOffer";
import addOrder from "./InquiryCom/addOrder";
import batchFreight from "./InquiryCom/batchFreight";
import addInquiryPrice from "./InquiryCom/addInquiryPrice";
import moresuPrice from "./InquiryCom/moresuPrice";
// 邀请报价
import addQuotationMember from "./InquiryCom/addQuotationMember.vue";
import store from "@/store";
import { mapGetters } from "vuex";
import { Message } from "element-ui";
import { divisionDeptList } from '@/api/company';
import CrmTag from "../../components/crmTag";
import {copyText} from '@/utils/index.js'

const defaultListQuery = {
  inquiryState: "", //询价状态(0待报价、10已取消询价、20采购已报价、30待采购确认价格、40待物流报价、50待成交、60未成交、70已下单)
  freightState: "", //物流状态(0未询运费，10待物流报价，20物流已报价)
  customerName: "", //客户名称
  brandName: "",
  departmentId:[],
  inquiryDate: [], //询价时间
  goodsSn: "", // 牌号
  pageNum: 1,
  pageSize: 20,
  tab: "myCreate", //类型(今日询价：today,我创建的：myCreate,我负责的：myCharge,全部询价:all)
  customerNumber:'',
  purchaseUserId:'',
  userId:'',
  goodsKingId:'',
  isEnableOrder:'',
  isNeedMyCharge:''
};
const defaultSendForm = {
  inquiryId: "",
  customerId: "",
  operateType: "editCompany",
  customerName: "",
};
const defaultColumns1 = [
  {
    field: "",
    title: "",
    width: 50,
    type: "checkbox",
  },
  {
    field: "userName",
    title: "业务员",
    width: 100,
  },
  {
    field: "chargeUserName",
    title: "采购员",
    width: 100,
  },
  {
    field: "customerNumber",
    title: "客户编号",
    width: 200,
    slots: {
      // 使用插槽模板渲染
      default: "customerName_default",
    },
  },
  {
    field: "goodsSn",
    title: "品名牌号",
    width: 180,
    slots: {
      // 使用插槽模板渲染
      default: "num4_default",
    },
  },

  {
    field: "receiveArea",
    title: "收货地区",
    width: 150,
  },
  {
    field: "expectGoodsPrice",
    title: "期望价格",
    width: 150,
  },
  {
    field: "receiveDate",
    title: "期望发货时间",
    width: 150,
  },
  {
    field: "latestReceiveDate",
    title: "最晚发货时间",
    width: 150,
  },
  {
    field: "inquiryUrgentType",
    title: "发货紧急程度",
    width: 150,
  },
  {
    field: "inquiryUrgentRemark",
    title: "紧急程度备注",
    width: 150,
  },
  {
    field: "goodsNum",
    title: "数量（吨）",
    width: 100,
  },
  {
    field: "sendTypes",
    title: "收货方式",
    width: 100,
  },
  {
    field: "payTypes",
    title: "结算方式",
    width: 100,
  },
  {
    field: "inquiryTime",
    title: "询价时间",
    width: 150,
  },
  {
    field: "reducePrice",
    title: "销售还价",
    width: 100,
  },
  {
    field: "pricePayTypes",
    title: "交易方式",
    width: 100,
  },
  {
    field: "sendArea",
    title: "发货地",
    width: 150,
  },
  {
    field: "fromCompany",
    title: "供货方",
    width: 150,
  },
  {
    field: "priceUserName",
    title: "报价人",
    width: 100,
  },
  {
    field: "priceCreateTime",
    title: "报价时间",
    width: 150,
  },
  {
    field: "priceStateStr",
    title: "报价状态",
    width: 100,
  },
  {
    field: "priceRemark",
    title: "报价备注",
    width: 100,
  },
  {
    field: "freightValue",
    title: "运费报价",
    width: 100,
  },
  {
    field: "freightUserName",
    title: "运费报价人",
    width: 100,
  },
  {
    field: "freightState",
    title: "运费状态",
    width: 100,
    slots: {
      default: "num7_default",
    },
  },
  {
    field: "freightRemark",
    title: "物流备注",
    width: 150,
  },
  {
    field: "freightTime",
    title: "运费报价时间",
    width: 150,
  },
  {
    field: "goodsMinProfit",
    title: "最低毛利",
    width: 100,
  },
  {
    field: "goodsNormProfit",
    title: "指导毛利",
    width: 100,
  },
  {
    field: "inquiryStateStr",
    title: "询价状态",
    width: 150,
  },
  {
    field: "inquiryRemark",
    title: "询价备注",
    width: 100,
  },
  {
    field: "saleCustomerType",
    title: "订单分类（销售）",
    width: 100,
  },
  {
    field: "unOrderType",
    title: "未成交分类",
    width: 100,
  },
  {
    field: "unOrderReason",
    title: "未成交原因",
    width: 100,
  },

  {
    field: "purchasePrice",
    title: "报价",
    width: 100,
    fixed: "right",
  },
  {
    field: "moresuPrice",
    title: "销售报价",
    width: 100,
    fixed: "right",
  },
  {
    field: "sendDate",
    title: "采购交期",
    width: 100,
    fixed: "right",
    slots: {
      default: "num9_default",
    },
  },
  {
    field: "priceSendTypes",
    title: "发货方式",
    width: 100,
    fixed: "right",
  },

  {
    field: "setting",
    title: "操作",
    width: 150,
    fixed: "right",
    slots: {
      // 使用插槽模板渲染
      default: "num3_default",
    },
  },
];
export default {
  name: "index",
  data() {
    return {
      roles: store.getters.roles ? store.getters.roles : [],
      names: store.getters.name ? store.getters.name : "",
      listQuery: JSON.parse(JSON.stringify(defaultListQuery)),
      sendForm: JSON.parse(JSON.stringify(defaultSendForm)),
      listLoading: false,
      orderLoading:false,
      dialogVisible2: false,
      btnLoading2: false,
      goodsSnlist: [], //商品牌号
      relationCusList: [],
      loading: false,
      loading2: false,
      dialogVisible: false,
      priceIds: "",
      customerList: [],
      salesmanLists: [],
      brandList: [],
      departmenList:[],
      options: [],
      count: 0,
      rules: {
        customerId: [
          { required: true, message: "此项必填", trigger: "change" },
        ],
      },
      selectCategoryIds: [],
      btnLoading: false,
      materialClassList: [],
      type: "",
      type2: "",
      gridOptions: {//我创建的
        loading: this.listLoading,
        border: true,
        id: "saleInquiry",
        align: "center",
        autoResize: true,
        height: 800,
        size: "mini",
        rowConfig: {
          keyField: "inquiryId",
          isHover: true,
        },
        columnConfig: {
          resizable: true,
        },
        customConfig: {
          storage: true,
        },
        checkboxConfig: {
          reserve: true,
        },
        toolbarConfig: {
          zoom: true,
          custom: true,
          slots: {
            buttons: "toolbar_buttons",
          },
        },
        spanMethod({
          row,
          rowIndex,
          $rowIndex,
          _rowIndex,
          column,
          columnIndex,
          $columnIndex,
          _columnIndex,
          visibleData,
        }) {
          let fields1 = [
            "userName",
            "chargeUserName",
            "customerName",
            "goodsSn",
            "receiveArea",
            "expectGoodsPrice",
            "receiveDate",
            "latestReceiveDate",
            "goodsNum",
            "sendTypes",
            "payTypes",
            "inquiryTime",
            "goodsMinProfit",
            "goodsNormProfit",
            "inquiryStateStr",
            "inquiryRemark",
            "saleCustomerType",
            "unOrderType",
            "unOrderReason",
            "purchaseCompetitive",
            "purchaseScore"
          ];
          if (!fields1.includes(column["field"])) {
            return { rowspan: 1, colspan: 1 };
          } else if (row["isMerge"] && fields1.includes(column["field"])) {
            return { rowspan: row["rowNum"], colspan: 1 };
          } else {
            return { rowspan: 0, colspan: 0 };
          }
        },
        columns:JSON.parse(JSON.stringify(defaultColumns1)),
        data: [{}],
      },
      gridOptions2: {//我负责的
        loading: this.listLoading2,
        border: true,
        id: "saleInquiry2",
        align: "center",
        autoResize: true,
        height: 800,
        size: "mini",
        rowConfig: {
          keyField: "inquiryId",
          isHover: true,
        },
        columnConfig: {
          resizable: true,
        },
        customConfig: {
          storage: true,
        },
        checkboxConfig: {
          reserve: true,
        },
        toolbarConfig: {
          zoom: true,
          custom: true,
          slots: {
            buttons: "toolbar_buttons",
          },
        },
        spanMethod({
          row,
          rowIndex,
          $rowIndex,
          _rowIndex,
          column,
          columnIndex,
          $columnIndex,
          _columnIndex,
          visibleData,
        }) {
          let fields2 = [ //需合并的单元格
            "chargeUserName",
            "expectGoodsPrice",
            "inquiryUserName",
            "inquiryInfo",
            "inquiryTime",
            "inquiryState",
            "inquiryRemark",
            "reducePrice",
            "priceCount",
            "priceNum",
            "customerTag",
            "setting2"
          ];
          if (!fields2.includes(column["field"])) {
            return { rowspan: 1, colspan: 1 };
          } else if (row["isMerge"] && fields2.includes(column["field"])) {
            return { rowspan: row["rowNum"], colspan: 1 };
          } else {
            return { rowspan: 0, colspan: 0 };
          }
        },
        columns: [
          {
            field: "",
            title: "",
            width: 50,
            type: "checkbox",
          },
          {
            field: "inquiryUserName",
            title: "询价人",
            width: 80,
          },
          {
            field: "customerTag",
            title: "客户标签",
            width: 130,
            slots: {
              default: "customerTag_default",
            },
          },

          {
            field: "inquiryInfo",
            title: "询价信息",
            width: 400,
            align: "left",
            slots: {
              default: "num5_default",
            },
          },
          {
            field: "chargeUserName",
            title: "采购人",
            width: 100,
            slots: {
              default: "chargeUserName",
            },
          },
          {
            field: "inquiryTime",
            title: "询价时间",
            width: 150,
          },
          {
            field: "inquiryState",
            title: "询价状态",
            width: 100,
            slots: {
              default: "num6_default",
            },
          },
          {
            field: "inquiryRemark",
            title: "询价备注",
            width: 100,
          },
          {
            field: "expectGoodsPrice",
            title: "期望价格",
            width: 100,
          },
          {
            field: "reducePrice",
            title: "销售还价",
            width: 100,
          },
          {
            field: "priceCount",
            title: "报价次数",
            width: 100,
          },
          {
            field: "purchasePrice",
            title: "报价价格",
            width: 100,
          },
          {
            field: "goodsNum",
            title: "报价数量(吨)",
            width: 150,
          },
          {
            field: "fromCompany",
            title: "供货方",
            width: 180,
          },
          {
            field: "sendDate",
            title: "发货时间",
            width: 150,
          },
          {
            field: "sendArea",
            title: "发货地",
            width: 150,
          },
          {
            field: "priceSendTypes",
            title: "发货方式",
            width: 100,
          },
          {
            field: "pricePayTypes",
            title: "交易方式",
            width: 100,
          },
          {
            field: "priceUserName",
            title: "报价人",
            width: 100,
          },
          {
            field: "priceTime",
            title: "报价时间",
            width: 150,
          },
          {
            field: "priceRemark",
            title: "报价备注",
            width: 150,
          },
          {
            field: "priceStateStr",
            title: "报价状态",
            width: 150,
          },
          {
            field: "noOrderReason",
            title: "未成交原因",
            width: 150,
          },
          {
            field: "costPrice",
            title: "采购成本价",
            fixed: "right",
            width: 100,
          },
          {
            field: "grossProfit",
            title: "采购吨毛利",
            fixed: "right",
            width: 100,
          },
          {
            field: "setting2",
            title: "询盘设置",
            fixed: "right",
            width: 150,
            slots: {
              default: "shareClickCount_default",
            },
          },
          {
            field: "setting",
            title: "操作",
            width: 100,
            fixed: "right",
            slots: {
              // 使用插槽模板渲染
              default: "num3_default",
            },
          },
        ],
        data: [],
      },
      records: [],
      records2: [],
      records3:[],
      dialogVisible3: false,
      othershipLists:[],
      customerInfo:{},
      userOptionList:[],
      userOptionList2:[],

      allInquiryCount:0,//全部询价条数
      waitPriceInquiryCount:0,//待采购报价条数
      waitCheckInquiryCount:0,//待采购确认条数
      orderInquiryCount:0,//已下单条数
      priceInquiryCount:0,//已报价条数
      unDealInquiryCount:0,//未成交条数
      outTimeInquiryCount:0,//已超期条数
      cancelInquiryCount:0,//已取消


      allInquiryGoodsNum :0,
      waitPriceInquiryGoodsNum :0,
      waitCheckInquiryGoodsNum :0,
      orderInquiryGoodsNum :0,
      priceInquiryGoodsNum:0,

      orderCustomerTypeList:[],
      options2:[],
      loadingoptions2:false,


      btnTypeLoading1:false,
      btnTypeLoading2:false,

      dialogContent:'',
      dialogTitle:'',
      copyWords:'',

      orderLoading1:false,

      pricePayTypes:''

    };
  },
  computed: {
    ...mapGetters(["name", "mobile", "userId"]),
    todayInquiryPrice() {
      if (this.roles.indexOf("todayInquiryPrice") != -1) {
        return true;
      } else {
        return false;
      }
    },
    myCreateInquiryPrice() {
      if (this.roles.indexOf("myCreateInquiryPrice") != -1) {
        return true;
      } else {
        return false;
      }
    },
    myChargeInquiryPrice() {
      if (this.roles.indexOf("myChargeInquiryPrice") != -1) {
        return true;
      } else {
        return false;
      }
    },
    allInquiryPrice() {
      if (this.roles.indexOf("allInquiryPrice") != -1) {
        return true;
      } else {
        return false;
      }
    },
  },
  created() {
    // this.getListData();
    this.getUserOptionList();
    this.getUserOptionList2();
    let now = new Date();
    let today = formatDate(now, "yyyy-MM-dd");
    this.listQuery.inquiryDate = [today, today];
    if (this.myChargeInquiryPrice&&!this.myCreateInquiryPrice) {//有我负责的权限，并且没有我创建的权限的直接显示我负责的tab
      this.listQuery.tab = 'myCharge';
    }
    if(this.$route.query.tab){
      this.listQuery.tab = this.$route.query.tab;
    }
    if(this.$route.query.type2){
        this.type2 = this.$route.query.type2
    }
    this.getList();
    this.getSalesmanList();
    this.getSaleDepartList();
    //获取订单分类列表
    getConfigList({status:1}).then((res)=>{
      let orderCustomerType = res.find((el)=>{
        return  el.cdtCode == 'order_customer_type'
      })
      this.orderCustomerTypeList = orderCustomerType ? orderCustomerType.data : []
    })

  },
  components: {
    CrmTag,
    addInquiryPrice,
    addInquirys,
    addPrice,
    loger,
    lowPrice,
    noDeal,
    offer,
    confirmOffer,
    addOrder,
    noPrice,
    batchFreight,
    addAdjustPrice,
    addTempOffer,
    addQuotationMember,
    moresuPrice
  },
  filters: {
    formatTime(time) {
      let date = new Date(time);
      return formatDate(date, "yyyy-MM-dd");
    },
    formatInquiryState(val) {
      if (val == 0) {
        return "待报价";
      } else if (val == 10) {
        return "已取消询价";
      } else if (val == 20) {
        return "采购已报价";
      } else if (val == 30) {
        return "待采购确认价格";
      } else if (val == 40) {
        return "待物流报价";
      } else if (val == 50) {
        return "待成交";
      } else if (val == 60) {
        return "未成交";
      } else if (val == 70) {
        return "已下单";
      }
    },
    formatFreightState(val) {
      if (val == 0) {
        return "未询运费";
      } else if (val == 10) {
        return "待物流报价";
      } else if (val == 20) {
        return "物流已报价";
      }
    },
  },
  methods: {
    //批量未成交原因填写
    batchNotSale() {
      if (this.records.length > 0) {
        this.$refs.noDeal.showPop5(this.records,'more');
      } else {
        Message.error("请勾选需要操作的记录");
      }
    },

    async copyItem(){
      let text = this.copyWords
      try {
        await copyText(text);
        this.$message.success("复制成功");
      } catch (err) {
        this.$message.error("复制失败");
      }
    },
    changeGoodsSnType(item,type){
      let data = {}
      data.inquiryId = item.inquiryId;
      if(type=='isEnableOrder'){
        data.isEnableOrder = item.isEnableOrder ;
      }else if(type=='isMallOrders'){
        data.isMallOrders = item.isMallOrders ;
      }
      setEnableOrder(data).then(()=>{
        this.handleSearchList()
        this.$message.success('操作成功！')
      })
    },
    changeMoreType(isEnableOrder){
      if (this.records2.length <= 0) {
        this.$message.error("请勾选需要操作的记录");
        return false
      }
      if(isEnableOrder == 1){
        this.btnTypeLoading1 = true
      }else{
        this.btnTypeLoading2 = true
      }
      let data = {}
      let inquiryId = this.records2.map(item=>item.inquiryId)
      data.inquiryId = inquiryId.join(",");
      data.isEnableOrder = isEnableOrder
      setEnableOrder(data).then(()=>{
        this.handleSearchList()
        this.btnTypeLoading1 = false
        this.btnTypeLoading2 = false
        this.$message.success('操作成功！')
      })
    },
    //获取商品列表
    remoteMethod2(query) {
      if (query !== '') {
        this.loadingoptions2 = true;
        goodsList({keywords:query}).then((res)=>{
          this.options2 = res.list;
          this.loadingoptions2 = false;
        }).catch(()=>{
          this.loadingoptions2 = false;
        });
      } else {
        this.loadingoptions2 = true;
        goodsList().then((res)=>{
          this.loadingoptions2 = res.list;
          this.loadingoptions2 = false;
        }).catch(()=>{
          this.loadingoptions2 = false;
        });
      }
    },

    setPurchaseCustomerType(item){
      editPurchaseCustomerType({inquiryId:item.inquiryId,purchaseCustomerType:item.newPurchaseCustomerType}).then(()=>{
          this.getList()
          this.$message({type:'success',message:'设置成功'})
      })
    },
    //点击复制分享链接
    copyShareInquiryUrl(row){
      addShareClick({inquiryId:row.inquiryId}).then((res)=>{
        const url = new URL(window.location.href);
        const domainName = url.origin;
        let link = domainName+'/#/invite?inquiryId='+row.inquiryId
        this.copyText(link)
        this.handleSearchList()
      })
    },
    copyText(t){
      if (!navigator.clipboard) {
        var ele = document.createElement("input");
        ele.value = t;
        document.body.appendChild(ele);
        ele.select();
        document.execCommand("copy");
        document.body.removeChild(ele);
        if (document.execCommand("copy")) {
          this.$message({
            message: '分享链接复制成功',
            type: 'success'
          });
        } else {
          this.$message({
            message: '分享链接复制失败',
            type: 'error'
          });
        }
      } else {
        navigator.clipboard.writeText(t).then(()=> {
          this.$message({
            message: '分享链接复制成功',
            type: 'success'
          });
        }).catch(()=> {
          this.$message({
            message: '分享链接复制失败',
            type: 'error'
          });
        })
      }
    },
    //获取采购下拉选项
    getUserOptionList2(){
      getOrderUsersList({departmentId:3}).then((res)=>{
        this.userOptionList2 = res;
      })
    },
    //获取业务下拉选项
    getUserOptionList(){
      getOrderUsersList({status:1}).then((res)=>{
        this.userOptionList = res;
      })
    },
    //获取客户信息
    getCustomerOrderInfo(customerId){
      customerOrderInfo({customerId:customerId}).then((res)=>{
          this.customerInfo = res
      })
    },
    //销售报价
    showMoresuPrice(row){
      this.$refs.moresuPrice.showPop3(row);
    },
    //推送至第三方
    pushInquiryToGxMore(row) {
      pushInquiryToGxMoreAPI({
        inquiryId:row.inquiryId
      }).then((res) => {
        Message.success("推送成功");
        this.handleSearchList()
      }).catch((error) => {
        console.log(error);
      })
   },
   // 获取销售部门列表
    getSaleDepartList() {
      divisionDeptList().then((res) => {
        this.departmenList = res
      }).catch((error) => {
        console.log(error);
      })
    },
    // 邀请报价
    invitQuotation(row) {
      this.$refs.addQuotationRef.dialogVisible = true;
      this.$refs.addQuotationRef.formDate.inquiryId = row.inquiryId;
    },
    // 获取厂家列表
    getBrandList(val) {
      if (val && val != "") {
        materialBrandList({ keywords: val }).then((res) => {
          this.brandList = res;
        });
      }
    },

    // 获取商品牌号
    getGoodsSnLists(queryString) {
      getGoodsSnList({ keywords: queryString }).then((res) => {
        this.goodsSnlist = res;
      });
    },

    //我要报价
    addPrice(row) {
      this.$refs.addInquiryPrice.showPop11(row);
    },

    //暂无报价
    noPrice(row) {
      this.$refs.noPrice.showPop4(row);
    },

    //批量询运费
    showPop11(type, item) {
      if (type == "oneXun") {
        if ((item.priceState == 20 ||item.priceState == 30 ||item.priceState == 50) &&item.freightState == 0) {
          this.$refs.batchFreight.showPop("inquiry", [item]);
        }
      } else if (type == "moreXun") {
        if (this.records.length > 0) {
          const data = this.records.every((el) => (el.priceState == 20 || el.priceState == 30 || el.priceState == 50)&& el.priceSendTypes == "自提"&& el.sendTypes == "送到"&& el.freightState == 0);
          if (data) {
            this.$refs.batchFreight.showPop("inquiry", this.records);
          } else {
            Message.error("选择的询价单中含有不能询运费的选项");
          }
        } else {
          Message.error("请勾选需要询运费的商品");
        }
      }
    },
    // 批量调价
    adjustPrice() {
      if (this.records2.length > 0) {
        let showPopFlag = this.records2.every((item) => {
          return item.priceId > 0;
        })
        if (showPopFlag) {
          this.$refs.addAdjustPrice.showPop(this.records2);
        } else {
          this.$message.warning('请勾选已报价的类目哦')
        }
      } else {
        this.$message.warning('请勾选调价类目哦')
      }
    },
    //产品线设置
    showCpx(row) {
      this.dialogVisible = true;
      this.materialClassList = [];
      this.getMyMaterialClassList();
    },

    // 取消设置产品线
    handleClose() {
      this.dialogVisible = false;
    },

    // 确认设置产品线
    handleConfirm() {
      this.btnLoading = true;
      const data = this.materialClassList.filter((item) => {
        return item.isSelected == 1;
      });
      const data2 = data.map((item) => item.categoryId);
      this.selectCategoryIds = data2.join(",");
      setAttentionCategoryId({ selectCategoryIds: this.selectCategoryIds })
        .then((res) => {
          Message.success("提交成功");
          this.dialogVisible = false;
          this.btnLoading = false;
        })
        .catch((err) => {
          this.btnLoading = false;
        });
    },
    //取消询价
    cancelPrice(item) {
      this.$confirm("确认取消询价吗？", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          inquiryOperate({
            inquiryId: item.inquiryId,
            operateType: "cancel",
            reducePrice: "",
            purchasePrice: "",
            unOrderReason: "",
          })
            .then((res) => {
              Message.success("取消询价成功");
              this.getList();
            })
            .catch((err) => {
              Message.error("取消询价失败");
            });
        })
        .catch(() => {});
    },
    // 获取我的指定牌号的货权列表
    getMyGoodsOwnerShip(inquiryPriceIds) {
      getMyGoodsOwnerShipAPI({inquiryPriceIds}).then((res) => {
        this.othershipLists = [];
        if (res.length) {
          res.forEach((item) => {
            if (item.ownershipList.length == 0) {//货权未归属
              this.othershipLists.push(item.goodsSn)
            }
          })
        }
      }).catch((error) => {
        console.log(error);
      })
    },
    //生成订单
    generateOrder(type, row,pricePayTypes) {
      this.pricePayTypes = pricePayTypes
      this.records3 = [];
      if (type == 'one') {
        this.getMyGoodsOwnerShip(row.priceId);
        if (row.priceState == 20 || row.priceState == 30 || row.priceState == 50) {
          this.records3.push(JSON.parse(JSON.stringify(row)));
          getPreOrderContent({ inquiryPriceIds: row.priceId,pricePayTypes:this.pricePayTypes }).then((res) => {
            if (res.cases.title) {
              this.dialogVisible3 = true;
              this.dialogTitle = res.cases.title
              this.copyWords = res.cases.copyWords
              this.dialogContent = res.cases.content
            } else {
              this.$refs.addOrder.showPop("inquiryPriceIds",this.records3,pricePayTypes)
            }
          });
        }
      } else if (type == 'more') {
        if (this.records.length > 0) {
          if(pricePayTypes == '承兑'){
            this.orderLoading1 = true;
          }else{
            this.orderLoading = true;
          }

          let priceIdFlag = this.records.every((el) => el.priceId !== '')
          if (priceIdFlag) {
            const priceIdsNum = this.records.map((item) => item.priceId);
            this.priceIds = priceIdsNum.join(",");
            this.getMyGoodsOwnerShip(this.priceIds);
            this.records3=JSON.parse(JSON.stringify(this.records));
            getPreOrderContent({ inquiryPriceIds: this.priceIds ,pricePayTypes:this.pricePayTypes}).then((res) => {
              this.orderLoading = false;
              this.orderLoading1 = false
              if (res.cases.title) {
                this.dialogVisible3 = true;
                this.dialogTitle = res.cases.title
                this.copyWords = res.cases.copyWords
                this.dialogContent = res.cases.content
              }else{
                this.$refs.addOrder.showPop("inquiryPriceIds",this.records3,pricePayTypes)
              }
            }).catch(()=>{
              this.orderLoading = false;
              this.orderLoading1 = false
            });
          } else {
            this.orderLoading = false;
            this.orderLoading1 = false
            Message.error("选择的订单中含有未报价的选项");
          }
        } else {
          Message.error("请勾选需要下单的订单");
        }
      }
    },
    // 下单注意提示
    handleConfirm3() {
      this.dialogVisible3 = false;
      this.$refs.addOrder.showPop("inquiryPriceIds", this.records3,this.pricePayTypes);
    },
    getSalesmanList() {
      getOrderUsersList().then((res) => {
        this.salesmanLists = res;
      });
    },
    //获取询价列表
    getList() {
      this.listLoading = true;
      let listQuery = JSON.parse(JSON.stringify(this.listQuery));
      if (listQuery.tab == "myCharge") { //我负责的
        listQuery.inquiryState = this.type2;
        getChargeList(listQuery)
          .then((response) => {
            this.gridOptions2.data = [];
            response.list.forEach((el, i) => {
              let newEL = JSON.parse(JSON.stringify(el));
              newEL.newPurchaseCustomerType = ''
              delete newEL.isNeedMyPrice;
              if (el.priceList.length == 0 || el.isNeedMyPrice == 1) {
                el.priceList.push({ //每一行追加报价字段
                  isNeedMyPrice: el.isNeedMyPrice,
                  isMyPrice: "",
                  priceUserId: "",
                  purchasePrice: "",
                  costPrice: "",
                  grossProfit:"",
                  priceNum: "",
                  fromCompany: "",
                  sendDate: "",
                  sendArea: "",
                  priceSendTypes: "",
                  pricePayTypes: "",
                  priceUserName: "",
                  priceTime: "",
                  priceRemark: "",
                  priceState: "",
                  priceStateStr: "",
                  reducePrice: "",
                  freightValue: "",
                  freightState: "",
                  freightStateStr: "",
                  freightTime: "",
                  freightUserName: "",
                  noOrderReason: "",
                  isIntroduce: "",
                });
              }
              el.priceList.forEach((ee, ii) => {
                let newEE = JSON.parse(JSON.stringify(ee));
                if (ii == 0) {
                  newEE.isMerge = true;
                  newEE.rowNum = el.priceList.length;
                } else {
                  newEE.isMerge = false;
                  newEE.rowNum = 0;
                }
                let copy = Object.assign({}, newEL, newEE);
                this.gridOptions2.data.push(copy);
              });
            });
            this.count = response.count;
            this.listLoading = false;
            this.allInquiryCount = response.allInquiryCount;
            this.waitPriceInquiryCount = response.waitPriceInquiryCount;
            this.waitCheckInquiryCount = response.waitCheckInquiryCount;
            this.orderInquiryCount = response.orderInquiryCount;
            this.priceInquiryCount = response.priceInquiryCount;

            this.allInquiryGoodsNum = response.allInquiryGoodsNum;
              this.waitPriceInquiryGoodsNum = response.waitPriceInquiryGoodsNum;
              this.waitCheckInquiryGoodsNum = response.waitCheckInquiryGoodsNum;
              this.orderInquiryGoodsNum = response.orderInquiryGoodsNum;
              this.priceInquiryGoodsNum = response.priceInquiryGoodsNum;
          })
          .catch(() => {
            this.listLoading = false;
          });
      } else {  //我创建的
        listQuery.inquiryState = this.type;
        getPriceList(listQuery)
          .then((response) => {
            this.gridOptions.data = [];
            response.list.forEach((el, i) => {
              let newEL = JSON.parse(JSON.stringify(el));
              if (el.priceList.length == 0) {
                el.priceList.push({ //每一行追加报价字段
                  priceId: "",
                  isMy: "",
                  priceSendTypes: "",
                  pricePayTypes: "",
                  fromCompany: "",
                  priceRemark: "",
                  priceUserName: "",
                  priceCreateTime: "",
                  priceNum: "",
                  reducePrice: "",
                  purchasePrice: "",
                  costPrice: "",
                  grossProfit: "",
                  sendDate: "",
                  sendArea: "",
                  freightValue: "",
                  freightState: "",
                  freightStateStr: "",
                  priceState: "",
                  priceStateStr: "",
                  freightTime: "",
                  freightUserName: "",
                  moresuPrice:""
                });
              }
              el.priceList.forEach((ee, ii) => {
                let newEE = JSON.parse(JSON.stringify(ee));
                if (ii == 0) {
                  newEE.isMerge = true;
                  newEE.rowNum = el.priceList.length;
                } else {
                  newEE.isMerge = false;
                  newEE.rowNum = 0;
                }
                let copy = Object.assign({}, newEL, newEE);
                this.gridOptions.data.push(copy);
              });
            });
            this.count = response.count;
            this.allInquiryCount = response.allInquiryCount;
            this.waitPriceInquiryCount = response.waitPriceInquiryCount;
            this.waitCheckInquiryCount = response.waitCheckInquiryCount;
            this.orderInquiryCount = response.orderInquiryCount;
            this.priceInquiryCount = response.priceInquiryCount;
            this.unDealInquiryCount = response.unDealInquiryCount;
            this.outTimeInquiryCount = response.outTimeInquiryCount;
            this.cancelInquiryCount = response.cancelInquiryCount
            this.listLoading = false;
          })
          .catch(() => {
            this.listLoading = false;
          });
      }
    },
    showPop2(item) {
      this.$refs.lowPrice.showPop2(item);
    },
    showPop3(item) {
      this.$refs.offer.showPop3(item);
    },
    showPop4(item) {
      this.$refs.addPrice.showPop4(item);
    },

    showPop5(item) {
      this.$refs.noDeal.showPop5(item);
    },
    showPop6(item) {
      this.$refs.loger.showPop6("inquiry", item);
    },
    // 发布询价  复制询价
    addInquiry(type, item) {
      if (type == 'add') {
       this.$refs.addInquirys.showPop10('add');
      }
      if (type == 'edit') {
        this.$refs.addInquirys.showPop10('edit',item);
      }
    },
    showPop8(item) {
      this.$refs.confirmOffer.showPop(item);
    },
    editTempOffer(item) {
      this.$refs.addTempOffer.showPop(item);
    },

    checkboxChange() {
      this.records = this.$refs.xGrid.getCheckboxRecords();
    },
    selectAllCheckboxChange(checked) {
      this.records = checked.records;
    },
    checkboxChange2() {
      this.records2 = this.$refs.xGrid2.getCheckboxRecords();
    },
    selectAllCheckboxChange2(checked) {
      this.records2 = checked.records;
    },
    changeType(type) {
      this.type = type;
      this.gridOptions.data = [];
      this.handleSearchList();
    },
    changeType2(type) {
      this.type2 = type;
      this.gridOptions2.data = [];
      this.handleSearchList();
    },
    /**
     * 切换选择状态
     */
    async handleSelect(key, keyPath) {
      this.listQuery = JSON.parse(JSON.stringify(defaultListQuery));
      this.type = "";
      this.type2 = "";
      this.records = [];
      this.listQuery.tab = key;
      let now = new Date();
      let today = formatDate(now, "yyyy-MM-dd");
      this.listQuery.inquiryDate = [today, today];
      this.gridOptions.columns = JSON.parse(JSON.stringify(defaultColumns1));
      if (key == 'today') { //今日询价
        this.gridOptions.columns = this.gridOptions.columns.filter((column) => {
          return column.field !== 'userName'
            && column.field !== 'chargeUserName'
            && column.field !== 'customerName'
            && column.field !== 'myOwnershipNum'
            && column.field !== 'receiveArea'
            && column.field !== 'expectGoodsPrice'
            && column.field !== 'inquiryUrgentRemark'
            && column.field !== 'payTypes'
            && column.field !== 'reducePrice'
            && column.field !== 'sendArea'
            && column.field !== 'fromCompany'
            && column.field !== 'priceStateStr'
            && column.field !== 'priceRemark'
            && column.field !== 'moresuPrice'
            && column.field !== 'costPrice'
            && column.field !== 'grossProfit'
            && column.field !== 'freightValue'
            && column.field !== 'freightUserName'
            && column.field !== 'freightState'
            && column.field !== 'freightRemark'
            && column.field !== 'freightTime'
            && column.field !== 'inquiryStateStr'
            && column.field !== 'inquiryRemark'
            && column.field !== 'saleCustomerType'
            && column.field !== 'unOrderType'
            && column.field !== 'unOrderReason'
        });
      }else if (key == 'all') { //全部询价
        this.gridOptions.columns = this.gridOptions.columns.filter((column) => {
          return column.field !== 'myOwnershipNum'
        });
        let newColumn1 = {
          field: "costPrice",
          title: "采购成本价",
          width: 100,
          fixed: "right",
        };
        let newColumn2 = {
          field: "grossProfit",
          title: "采购吨毛利",
          width: 100,
          fixed: "right",
        };
        this.gridOptions.columns.splice(this.gridOptions.columns.length-3,0,newColumn1, newColumn2);
      }
      this.handleSearchList();
      if (key == "myCreate" || key == "all") {
        setTimeout(() => {
          this.$refs.xGrid.clearCheckboxRow();
        }, 500);
      }
    },
    // 设置我关注的商品价格分类
    getMyMaterialClassList() {
      myMaterialClassList().then((res) => {
        this.materialClassList = res;
      });
    },
    handleClose2() {
      this.dialogVisible2 = false;
    },
    handleConfirm2() {
      const data = JSON.parse(JSON.stringify(this.sendForm));
      delete data.customerName;
      this.$refs.sendForm.validate((valid) => {
        if (valid) {
          this.btnLoading2 = true;
          inquiryOperate(data)
            .then((res) => {
              Message.success("更改成功");
              this.getList();
              this.dialogVisible2 = false;
              this.btnLoading2 = false;
            })
            .catch((err) => {
              this.btnLoading2 = false;
            });
        }
      });
    },
    editCompany(data) {
      this.sendForm = JSON.parse(JSON.stringify(defaultSendForm));
      this.sendForm.customerName = data.customerName;
      this.sendForm.inquiryId = data.inquiryId;
      relationCustomers({ customerId: data.customerId }).then((res) => {
        this.relationCusList = res;
      });
      this.dialogVisible2 = true;
    },

    // 获取我的客户名称
    getMyCustomerName(queryString) {
      if (queryString && queryString != "") {
        if (this.listQuery.tab == "all") {
          getCustomerList({ keywords: queryString, tab: "all" }).then((res) => {
            this.customerList = res;
          });
        } else {
          getCustomerList({ keywords: queryString, tab: "my" }).then((res) => {
            this.customerList = res;
          });
        }
      }
    },
    handleSearchList() {
      if (this.listQuery.tab == "myCreate" || this.listQuery.tab == "all") {
        setTimeout(() => {
          this.$refs.xGrid.clearCheckboxRow();
        }, 500);
      }else if(this.listQuery.tab == "myCharge"){
        setTimeout(() => {
          this.$refs.xGrid2.clearCheckboxRow();
        }, 500);
      }
      this.records = [];
      this.records2 = [];
      this.listQuery.pageNum = 1;
      this.getList();
    },

    handleSizeChange(val) {
      this.listQuery.pageNum = 1;
      this.listQuery.pageSize = val;
      if (this.listQuery.tab == "myCreate" || this.listQuery.tab == "all") {
        setTimeout(() => {
          this.$refs.xGrid.clearCheckboxRow();
        }, 500);
      }else if(this.listQuery.tab == "myCharge"){
        setTimeout(() => {
          this.$refs.xGrid2.clearCheckboxRow();
        }, 500);
      }
      this.records = [];
      this.records2 = [];
      this.getList();
    },
    handleCurrentChange(val) {
      this.listQuery.pageNum = val;
      if (this.listQuery.tab == "myCreate" || this.listQuery.tab == "all") {
        setTimeout(() => {
          this.$refs.xGrid.clearCheckboxRow();
        }, 500);
      }else if(this.listQuery.tab == "myCharge"){
        setTimeout(() => {
          this.$refs.xGrid2.clearCheckboxRow();
        }, 500);
      }
      this.records = [];
      this.records2 = [];
      this.getList();
    },
  },
};
</script>

<style scoped lang="scss">
.table-row:first-child {
  border-top: 1px solid #ddd;
}
.table-row {
  border: 1px solid #ddd;
  border-top: 0;
}
.table-col {
  padding: 2px 10px;
}
.table-col:first-child {
  border-right: 1px solid #ddd;
  background: #f2f2f2;
  font-weight: bold;
}
::v-deep .el-table__body-wrapper::-webkit-scrollbar {
  width: 8px !important;
  height: 8px !important;
  background: #eeeeee !important;
}

::v-deep .el-table__body-wrapper::-webkit-scrollbar-track {
  border-radius: 10px !important;
  background: #eeeeee !important;
}

::v-deep .el-table__body-wrapper::-webkit-scrollbar-thumb {
  border-radius: 10px !important;
  background: #eeeeee !important;
}
</style>

<style>
.popper-zdy{
  background: none !important;
  padding: 0px !important;
  box-shadow: none !important;
  border:none !important;
}
</style>
